1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.google.common.collect.testing.testers;
18
19 import com.google.common.annotations.GwtCompatible;
20 import com.google.gwt.core.client.GWT;
21
22
23
24
25
26
27 @GwtCompatible(emulated = true)
28 final class Platform {
29
30
31
32 static int listListIteratorTesterNumIterations() {
33
34 return GWT.isProdMode() ? 2 : 4;
35 }
36
37
38
39 static int collectionIteratorTesterNumIterations() {
40 return GWT.isProdMode() ? 3 : 5;
41 }
42
43
44 static String format(String template, Object... args) {
45
46 StringBuilder builder = new StringBuilder(
47 template.length() + 16 * args.length);
48 int templateStart = 0;
49 int i = 0;
50 while (i < args.length) {
51 int placeholderStart = template.indexOf("%s", templateStart);
52 if (placeholderStart == -1) {
53 break;
54 }
55 builder.append(template.substring(templateStart, placeholderStart));
56 builder.append(args[i++]);
57 templateStart = placeholderStart + 2;
58 }
59 builder.append(template.substring(templateStart));
60
61
62 if (i < args.length) {
63 builder.append(" [");
64 builder.append(args[i++]);
65 while (i < args.length) {
66 builder.append(", ");
67 builder.append(args[i++]);
68 }
69 builder.append("]");
70 }
71
72 return builder.toString();
73 }
74
75 private Platform() {}
76 }